package ru.jkff.jalgebra.core;

/**
 * User: jkff
 * Date: Aug 23, 2009
 * Time: 12:41:50 PM
 */
public abstract class FunctionUtils {
    private FunctionUtils() {}
    
    public static <X,Y> InvertibleFunction<Y,X> invert(final InvertibleFunction<X,Y> f) {
        return new InvertibleFunction<Y, X>() {
            public X apply(Y y) { return f.unapply(y); }
            public Y unapply(X x) { return f.apply(x); }
        };
    }
}
